package function;

@FunctionalInterface
interface Operations {
    int operation(int a, int b);
}

class Test {
    public int operate(int a, int b, Operations operation) {
        return operation.operation(a, b);
    }

}

class FutureMains {
    public static void main(String[] args) {
        System.out.println("this project is java1.8 new future Demon");
        Test test = new Test();
        int operate = test.operate(1, 2, new Operations() {
            @Override
            public int operation(int a, int b) {
                return a + b;
            }
        });
        System.out.println("===operate:" + operate);

        // lambda和函数式接口
        int operate1 = test.operate(1, 2, (a, b) -> a + b);
        System.out.println("===operate1:" + operate1);
    }
}

